package cn.abcsys.cloud.devops.pipeline.core;

import java.util.Map;

import cn.abcsys.cloud.devops.pipeline.common.CiHost;
import cn.abcsys.cloud.devops.pipeline.common.GitLab;
import cn.abcsys.cloud.devops.pipeline.common.JenkinsItem;
import cn.abcsys.cloud.devops.pipeline.util.Result;

public interface PipelineCore {
	/**
	 * 获取项目
	 * @param gitLabProject
	 * @param private_token
	 * @return
	 */
	public Result getGitProjects(GitLab gitLab,String private_token);
	/**
	 * 获取单个项目
	 * @param projectId
	 * @param private_token
	 * @return
	 */
	public Result getGitSingleProject(GitLab gitLab,String private_token);
	/**
	 * 获取项目分支
	 * @param projectId
	 * @param private_token
	 * @return
	 */
	public Result getGitProjectBranches(GitLab gitLab,String private_token);
	/**
	 * 获取项目分支
	 * @param projectId
	 * @param private_token
	 * @param branch_name
	 * @return
	 */
	public Result getGitProjectSingleBranch(GitLab gitLab,String private_token,String branch_name);
	/**
	 * 获取项目的触发机制
	 * @param projectId
	 * @param private_token
	 * @return
	 */
	public Result getGitProjectHooks(GitLab gitLab,String private_token);
	/**
	 * 获取项目触发机制
	 * @param projectId
	 * @param private_token
	 * @param hookId
	 * @return
	 */
	public Result getGitProjectSingleHook(GitLab gitLab,String private_token,String hookId);
	/**
	 * 创建项目触发机制
	 * @param private_token
	 * @param url
	 * @param events
	 * @return
	 */
	public Result createGitProjectHook(GitLab gitLab,String private_token,String hookUrl,Map<String,Boolean> events);
	/**
	 * 删除项目触发机制
	 * @param private_token
	 * @return
	 */
	public Result deleteGitProjectHook(GitLab gitLab,String private_token);
	/**
	 * 下载源码
	 * @param sourcePath源码下载位置
	 * @param branch指定分支
	 * @param gitAddress地址
	 * @return
	 */
	public Result gitClone(CiHost ciHost,String sourcePath,String branch,String gitAddress);
	/**
	 * 源码扫描
	 * @param ciHost
	 * @param sourcePath
	 * @return
	 */
	public Result sonarSourceScanner(CiHost ciHost,String sourcePath);
	/**
	 * 单元测试
	 * @param sourcePath源码地址
	 * @return
	 */
	public Result mavenUnitTest(CiHost ciHost,String sourcePath);
	/**
	 * 源码编译打包
	 * @param ciHost
	 * @param sourcePath
	 * @return
	 */
	public Result mavenSourcePackage(CiHost ciHost,String sourcePath);
	/**
	 * 创建一个jenkins　job
	 * @param jenkinsItem
	 * @return
	 */
	public Result createJenkinsProject(JenkinsItem jenkinsItem);
	/**
	* @Title: getJobConsoleLog 
	* @Description: 根据jobName与构建次数number获取输出log
	* @param @param jenkinsItem
	* @param @return    设定文件 
	* @return Result    返回类型 
	* @throws
	 */
	public Result getJobConsoleLog(JenkinsItem jenkinsItem);
	/**
	* @Title: buildJob 
	* @Description: 根据jobName名称，执行构建操作
	* @param @param jenkinsItem
	* @param @return    设定文件 
	* @return Result    返回类型 
	* @throws
	 */
	public Result buildJob(JenkinsItem jenkinsItem);
	/**
	 * 
	* @Title: getImageIdByImageNameInPipeline 
	* @Description: 根据镜像名称查询镜像ID在pipeline
	* @param @param imageName
	* @param @return    设定文件 
	* @return Result    返回类型 
	* @throws
	 */
	public Result getImageIdByImageNameInPipeline(String imageName);
}
